<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>
<script type="text/javascript">
// <![CDATA[
function getLabel(fieldName){
	var labels = {
	  <?php
	  $count = 0;
	  foreach($form as $formfield){
			$key = $formfield->renderName();
			$val = $formfield->renderLabelName();
			echo "'". html_entity_decode(htmlentities($key, ENT_QUOTES)) ."':'". html_entity_decode(htmlentities($val, ENT_QUOTES)) ."'". (($form->count() - 1 == $count++) ? '' : ','); 
	  }
	  ?>
	};
	return labels[fieldName];
}
</script>

	<?php //echo  $objDef->renderDefaultForm($form, $formAction = 'attachments/addFiles', $module = 'attachments', 'attachment');?>
	
	<?php echo $objDef->renderDefaultForm2($form, $formAction = url_for('attachments/addFiles?upload=true&saveToDB='.$saveToDB), 
										$module = 'attachments', 'attachment', $hide = array(), 
										true, 'addfileTarget',  'Items',true, get_class($form), array('class'=>'itemForm'));?>
										
	<iframe id="addfileTarget" src="#" style="width:0;height:0;border:0px solid #fff;" name="addfileTarget"></iframe>
	
	

<script type="text/javascript">

function submitForm(idForm){
	var result = tmt.validator.validateForm(idForm);
	if(result){
		document.forms[idForm].submit();
	}
}


</script>	